package com.endava.Generics;

import java.util.List;

public class Util {

	public static <T extends Number> int countOddNumbers(List<T> list,
			NumberOperation<T> numberOp) {
		int count = 0;

		for (T elem : list) {
			if (numberOp.isOdd(elem)) {
				count++;
			}
		}

		return count;
	}

	public static <T extends Number> int countPrimeNumbers(List<T> list,
			NumberOperation<T> numberOp) {
		int count = 0;

		for (T elem : list) {
			if (numberOp.isPrime(elem)) {
				count++;
			}
		}

		return count;
	}

}
